package io.gitee.yth.design.pattern.test.core.pattern.behavioral.template;

/**
 * @author yth
 * @since 2023-04-28-18:08
 */
public abstract class SoybeanMilkTemplate {

    /**
     * final修饰的模板方法
     */
    public final void makeSoybeanMilk() {
        screen();
        soak();
        grind();
        filter();
        boil();
        addCondiments();
    }

    abstract protected void screen();

    protected void soak() {
        System.out.println("浸泡 ...");
    }

    protected void grind() {
        System.out.println("磨碎大豆 ...");
    }

    protected void filter() {
        System.out.println("过滤豆渣 ...");
    }

    protected void boil() {
        System.out.println("煮沸 ...");
    }

    /**
     * 模板中的空方法 --> 钩子方法
     */
    protected void addCondiments() {
        // For subclasses: do nothing by default.
    }

}
